Owner and SystemDB Properties Example

This example uses the Owner and SystemDB properties to show the owners of a variety of Document objects.

Sub OwnerX()

   ' Ensure that the Microsoft Jet workgroup file is 
   ' available.
   DBEngine.SystemDB = "system.mdw"

   Dim dbsNorthwind As Database
   Dim ctrLoop As Container

   Set dbsNorthwind = OpenDatabase("Northwind.mdb")

   With dbsNorthwind
      Debug.Print "Document owners:"
      ' Enumerate Containers collection and show the owner 
      ' of the first Document in each container's Documents 
      ' collection.
      For Each ctrLoop In .Containers
         With ctrLoop
            Debug.Print "  [" & .Documents(0).Name & _
               "] in [" & .Name & _
               "] container owned by [" & _
               .Documents(0).Owner & "]"
         End With
      Next ctrLoop

      .Close
   End With

End Sub